# strip 相关符号
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")

# 关闭异常和 RTTI（对 C++ 有效）
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti")

# 编译优化开启
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Os")  # 尽量 -Os 而不是 -O0/-O2


# 包含头文件目录
include_directories(
    ${CMAKE_CURRENT_SOURCE_DIR}/include
    ${CMAKE_CURRENT_SOURCE_DIR}/include/util
    ${CMAKE_CURRENT_SOURCE_DIR}/linux
)

# 设置源文件
# set(SOURCE_FILES
#     src/CIap2Sqlite.cpp
#     src/CIpodConfig.cpp
#     src/CIpodEvent.cpp
#     src/CIpodIap2.cpp
#     src/CIpodLibWrapper.cpp
#     src/CIpodLog.cpp
#     src/CIpodProtocol.cpp
#     src/CIpodVehicle.cpp
#     src/CIpodChip.cpp
#     src/CIpodDevice.cpp
#     src/CIpodIap1.cpp
#     src/CIpodLib.cpp
#     src/CIpodList.cpp
#     src/CIpodNative.cpp
#     src/CIpodSync.cpp
#     src/CIpodHandler.cpp
#     src/RandomNumberUtils.c
#     src/DataReceiver.cpp
#     src/util/CStrTool.cpp
#     src/util/ByteTool.cpp
#     src/util/pinyin.c
#     src/util/rgbtobmp.c
# )

# 添加主 src 目录的所有 .cpp/.c 文件
aux_source_directory(src SOURCE_FILES)
aux_source_directory(src/util SOURCE_FILES)


# 添加编译选项
add_compile_options(
    -DBUILD_FOR_ANDROID
    -Wno-error=date-time
    -Wno-error=int-conversion
)

# 添加共享库
add_library(iap2CPP SHARED ${SOURCE_FILES})

# 链接 log 库（仅当是 Android 时）
target_link_libraries(iap2CPP
    SharkCoreUtils  # 如果你已有该库，也可改为路径方式或使用 add_subdirectory
)
